package gpstools.track;

import java.io.Serializable;

/**
 * Additional information regarding the track section
 * 
 * @author Marcin Skruch
 */
public class LapInfo extends AdditionalInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    private static final String DISTANCE = "gpstools.track.Lap.distance";
    private static final String ELEVATION_GAIN = "gpstools.track.Lap.elevationGain";
    private static final String ELEVATION_LOSS = "gpstools.track.Lap.elevationLoss";
    private static final String HEART_RATE = "gpstools.track.Lap.heartRate";
    private static final String MAXIMUM_HEART_RATE = "gpstools.track.Lap.maximumHeartRate";
    private static final String CADENCE = "gpstools.track.Lap.cadence";
    private static final String SPEED = "gpstools.track.Lap.speed";
    private static final String TOTAL_TIME = "gpstools.track.Lap.totalTime";
    private static final String MAXIMUM_SPEED = "gpstools.track.Lap.maximumSpeed";
    private static final String CALORIES = "gpstools.track.Lap.calories";

    public Double setDistance(Double distance) {
        return (Double) set(DISTANCE, distance);
    }

    public Double getDistance() {
        return (Double) get(DISTANCE);
    }

    public Double setElevationGain(Double elevationGain) {
        return (Double) set(ELEVATION_GAIN, elevationGain);
    }

    public Double getElevationGain() {
        return (Double) get(ELEVATION_GAIN);
    }

    public Double setElevationLoss(Double elevationLoss) {
        return (Double) set(ELEVATION_LOSS, elevationLoss);
    }

    public Double getElevationLoss() {
        return (Double) get(ELEVATION_LOSS);
    }

    public Short setAverageHeartRate(Short heartRate) {
        return (Short) set(HEART_RATE, heartRate);
    }

    public Short getAverageHeartRate() {
        return (Short) get(HEART_RATE);
    }

    public Short setAverageCadence(Short cadence) {
        return (Short) set(CADENCE, cadence);
    }

    public Short getAverageCadence() {
        return (Short) get(CADENCE);
    }

    /**
     * @param speed
     *            average lap speed [meters per second, m/s]
     * @return previous value
     */
    public Double setAverageSpeed(Double speed) {
        return (Double) set(SPEED, speed);
    }

    /**
     * @return average lap speed [meters per second, m/s]
     */
    public Double getAverageSpeed() {
        return (Double) get(SPEED);
    }

	/**
	 * @param time
	 *            total time in seconds
	 * @return previous value
	 */
	public Double setTotalTime(Double time) {
		return (Double) set(TOTAL_TIME, time);
	}

	public Double getTotalTime() {
		return (Double) get(TOTAL_TIME);
	}

	public void setMaximumSpeed(Double speedInMetersPerSecond) {
		set(MAXIMUM_SPEED, speedInMetersPerSecond);
	}

	public Double getMaximumSpeed() {
		return (Double) get(MAXIMUM_SPEED);
	}

	public void setCalories(Integer calories) {
		set(CALORIES, calories);
	}

	public Integer getCalories() {
		return (Integer) get(CALORIES);
	}

	public Short getMaximumHeartRate() {
		return (Short) get(MAXIMUM_HEART_RATE);
	}

	public void setMaximumHeartRate(Short heartRate) {
		set(MAXIMUM_HEART_RATE, heartRate);
	}
}
